package com.itcase.JDBC_01.JDBCDome;

import java.sql.*;

public class JDBCUtils {
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");

        Connection con = DriverManager.getConnection("jdbc:mysql://localhost/db2","root","root");

        Statement stat = con.createStatement();

        //String sql = "SELECT * FROM user";

        ResultSet res = stat.executeQuery("SELECT * FROM user");

        while (res.next()){
            System.out.println(res.getInt("id")+ "\t"+res.getString("name")+res.getInt("age"));
        }
    }
}
